package com.moji.controller.api;


import com.moji.common.base.ApiResult;
import com.moji.entity.MjProductPurchase;
import com.moji.entity.MjSupportHelp;
import com.moji.entity.dto.QueryProductPurchaseDto;
import com.moji.entity.dto.QuerySupportHelpDto;
import com.moji.service.MjProductPurchaseService;
import com.moji.service.MjSupportHelpService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * <p>
 * 产品选购配置表 前端控制器
 * </p>
 *
 * @author ccl
 * @since 2024-08-13
 */
@RestController
@RequestMapping("/api/mjProductPurchase")
@Api(tags = "产品选购api相关接口", value = "产品选购api相关接口")
public class MjProductPurchaseController {

    @Resource
    private MjProductPurchaseService mjProductPurchaseService;

    @PostMapping("/queryByPage")
    @ApiOperation(value = "产品选购_分页查询",response = MjProductPurchase.class)
    public ApiResult queryByPage(@RequestBody QueryProductPurchaseDto dto){
        return ApiResult.ok(mjProductPurchaseService.queryByPage(dto));
    }

    @PostMapping("/detail")
    @ApiOperation(value = "产品选购_详情",response = MjProductPurchase.class)
    public ApiResult detail(@RequestParam("id") Long id){
        return ApiResult.ok(mjProductPurchaseService.detail(id));
    }

    @PostMapping("/add")
    @ApiOperation(value = "产品选购_新增",response = Boolean.class)
    public ApiResult add(@Validated @RequestBody MjProductPurchase mjProductPurchase){
        return ApiResult.ok(mjProductPurchaseService.add(mjProductPurchase));
    }

    @PostMapping("/edit")
    @ApiOperation(value = "产品选购_编辑",response = Boolean.class)
    public ApiResult edit(@Validated @RequestBody MjProductPurchase mjProductPurchase){
        return ApiResult.ok(mjProductPurchaseService.edit(mjProductPurchase));
    }

    @GetMapping("/delete")
    @ApiOperation(value = "产品选购_删除",response = Boolean.class)
    public ApiResult delete(@RequestParam("id") Long id){
        return ApiResult.ok(mjProductPurchaseService.delete(id));
    }

}

